// DDS
// MongoDB
resource "huaweicloud_dds_instance" "this" {
  count = var.dds_create ? 1 : 0

  name = var.dds_name

  datastore {
    type           = "DDS-Community"
    version        = "4.0"
    storage_engine = "wiredTiger"
  }

  availability_zone = data.huaweicloud_availability_zones.this.names[0]
  vpc_id            = huaweicloud_vpc.this.id
  subnet_id         = huaweicloud_vpc_subnet.this.0.id
  security_group_id = huaweicloud_networking_secgroup.this.id
  password          = var.dds_password
  mode              = title("single")

  flavor {
    type      = "single"
    num       = 1
    storage   = "ULTRAHIGH"
    size      = 30
    spec_code = "dds.mongodb.c3.large.2.single"
  }

  #enterprise_project_id = var.enterprise_project_id
  depends_on = [huaweicloud_vpc_subnet.this]
}
